package com.msr.common;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.msr.bean.NaviPack;

public class SysComm {

	public static String double2String(double input) {
		String output = Double.toString(input);
		return output.substring(0, output.lastIndexOf(".") + 2);
	}

	public static int getMaxYM() {
		int ym = 0;
		try {
			DbSource d = new DbSource();
			Connection conn = d.getConn();
			String sql = "select max(ym) as `ym` from datatable";
			PreparedStatement pstmt = conn.prepareStatement(sql);
			ResultSet rs = pstmt.executeQuery();

			while (rs.next()) {
				ym = rs.getInt("ym");
				break;
			}
			rs.close();
			pstmt.close();
			conn.close();
			return ym;
		} catch (Exception e) {
			e.printStackTrace();
			return ym;
		}

	}
}
